import time

from public.action import *
from public.business import *
from public.testData import *
from public.tools import *

testCase = "dbshopST012_搜索商品"

# 打开后台网址
firefox = openBrowser(urlAdmin)
# 登陆
DBshopLoginAdmin(firefox)
# 进入二级菜单
DBshopEnterMenu2(firefox, '商品管理', '管理商品')
firefox.find_element_by_name('goods_name').send_keys('美的')
firefox.find_element_by_xpath('//button').click()

#断言
try:
    firefox.find_element_by_xpath('//td[contains(.,"美的")]')
    writeLog("%s 测试通过" % testCase)
except:
    writeLog("%s 测试失败" % testCase)
    getPhoto(firefox)
firefox.quit()